<?php

/**
 * login actions.
 *
 * @package    mgm_system
 * @subpackage login
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class select_directoryActions extends sfActions {
	/**
	 * Executes index action
	 *
	 * @param sfRequest $request A request object
	 */
	public function executeIndex(sfWebRequest $request) {
		
		$this->directories = $this->getUser()->getAttribute('rol_id') == sfConfig::get('app_admin') ? Doctrine_Core::getTable ( 'MasterDirectory' )->retreiveActiveDirectories () : Doctrine_Core::getTable ( 'MasterDirectory' )->getByUser ($this->getUser()->getAttribute('user_id'));
	
	}
	
	public function executeSet_directory(sfWebRequest $request) {
		
		$this->getUser ()->setAttribute ( "directory_id", $request->getParameter('sl_master_directory') );
		
		return $this->redirect("directories/index");
	
	}

}
